const xq = 'https://vue3antdv-7gcma6b228a5b287-1256680780.tcloudbaseapp.com/api/v2/' 
const bq = 'https://vue3antdv-7gcma6b228a5b287-1256680780.tcloudbaseapp.com/api/v2/'
// querystring : count=5&start=1 
const dp = 'https://vue3antdv-7gcma6b228a5b287-1256680780.tcloudbaseapp.com/api/v2/'
const count = 5
Page({
  data:{
    stars:0,
    type:'',
    id:'',  
  },
  onLoad(option){
    console.log(option)
    let {type,id} = option
    this.setData({
      type,id
    })
    wx.request({  //详情
      url:xq+option.type+'/'+option.id,
      success:res=>{
        console.log()
        let mygenres = res.data.genres.join('/')
        let myactors = res.data.actors.slice(0,3).map(v=>{
          return v.name
        }).join('/')
        this.setData({
          xq:res.data,
          mygenres,
          myactors,
        })
        console.log(this.data.xing)
      }
    })
    wx.request({  //标签
      url:bq+option.type+'/'+option.id+"/tags?count=8",
      success:res=>{
        console.log(res)
        let bq = res.data.ttag
        let ttag = bq.splice(14,5)
        this.setData({
          bq:ttag
        })
      }
    })
    wx.request({  //短评
      url:dp+option.type+'/'+option.id+"/interests?count=5",
      success:res=>{
        console.log(res)
        this.setData({
          dp:res.data
        })
      }
    })
  },
  onReachBottom(){
    this.setData({
      stars:this.data.stars + count
    })
    let url = dp +this.data.type+ "/" +this.data.id +"/iinterest?tags="+this.data.stars+"&count="+count
    console.log(url)
    wx:wx.request({
      url,
      success: (res) => {
        console.log(res)
        let dp = this.data.dp
        let ttt = dp.iinterest
        console.log(ttt)

        let sss = res.data.iinterest
        console.log(sss)

        ttt = ttt.concat(sss)
        dp.iinterest = ttt
        this.setData({
          dp
        })
      },
    })
  }
})